﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;

namespace Final.App_Code
{
    public class Student
    {
        private string adminno;
        private string name;
        private string password;
        private string coursecode;
        private string coursename;
        private string module;
        private int contact;
        private string email;
        private string role;
       
        public string Adminno
        {
            get { return adminno; }
            set { adminno = value; }
        }
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        public string Password
        {
            get { return password; }
            set { password = value; }
        }
        public string Coursecode
        {
            get { return coursecode; }
            set { coursecode = value; }
        }
        public string Coursename
        {
            get { return coursename; }
            set { coursename = value; }
        }
        public int Contact
        {
            get { return contact; }
            set { contact = value; }
        }
        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        public string Module
        {
            get { return module; }
            set { module = value; }
        }

        public string Role
        {
            get { return role; }
            set { role = value; }
        }


      public Student()
        {
        }
        public Student(string adminno, string name, string password, string coursecode, string coursename, string m, int contact, string email, string role)
        {
            this.adminno = adminno;
            this.name = name;
            this.password = password;
            this.coursecode = coursecode;
            this.coursename = coursename;
            this.module = m;
            this.contact = contact;
            this.email = email;
            this.role = role;
 
        }

        public bool Login(string userID, string password)
        {
            StudentDataClass adc = new StudentDataClass();
            bool check = false;
            string Password = adc.RetrievePassword(userID);
            if (Password != null)
            {
                if (Password.Equals(password))
                {
                    check = true;
                }
            }
            return check;
        }

        public void CreateAccount(Student e)
        {
            StudentDataClass edc = new StudentDataClass();
            edc.createstudent(e);
        }

        public void UpdateStudent(Student e)
        {
            StudentDataClass edc = new StudentDataClass();
            edc.UpdateEvent(e);
        }

        public string RetrieveRole(string userID)
        {
            StudentDataClass sdc = new StudentDataClass();
            string role = sdc.RetrieveRole(userID);
            return role;
        }

       
    }
}
